﻿''' <summary>
''' Provides information about an argument expected by a command. This information is used to populate the default help system.
''' </summary>
''' <remarks></remarks>
<AttributeUsage(AttributeTargets.Method, AllowMultiple:=True)>
Public Class CommandMethodArgumentAttribute
    Inherits Attribute
    Implements IComparable

    Private _ArgumentName As String
    Public ReadOnly Property ArgumentName As String
        Get
            Return _ArgumentName
        End Get
    End Property

    Private _FormattedHelpText As String
    Public ReadOnly Property FormattedHelpText As String
        Get
            Return _FormattedHelpText
        End Get
    End Property

    Private _Order As Integer
    Public ReadOnly Property Order As Integer
        Get
            Return _Order
        End Get
    End Property

    ''' <summary>
    ''' Creates a new method argument attribute with the specified argument name and help text. This argument will have an Order of 0.
    ''' </summary>
    ''' <param name="name">The name of the command argument.</param>
    ''' <param name="helpText">The detailed formatted help text associated with this argument.</param>
    ''' <remarks></remarks>
    Public Sub New(name As String, helpText As String)
        Me.New(name, 0, helpText)
    End Sub

    ''' <summary>
    ''' Creates a new method argument attribute with the specified argument name, order, and help text.
    ''' </summary>
    ''' <param name="name">The name of the command argument.</param>
    ''' <param name="paramOrder">The order of the argument when a command requires multiple arguments.</param>
    ''' <param name="helpText">The detailed formatted help text associated with this argument.</param>
    ''' <remarks></remarks>
    Public Sub New(name As String, paramOrder As Integer, helpText As String)
        _ArgumentName = name
        _FormattedHelpText = helpText
        _Order = paramOrder
    End Sub

    Public Function CompareTo(obj As Object) As Integer Implements System.IComparable.CompareTo
        If TypeOf obj Is CommandMethodArgumentAttribute Then
            Return _Order.CompareTo(CType(obj, CommandMethodArgumentAttribute)._Order)
        End If
        Return -1
    End Function
End Class
